﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace HRM.Converter
{
    public class ConvertDepartmentSearchModeToBoolean : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || parameter == null) return false;
            int mode = (int)value;
            int para = System.Convert.ToInt16(parameter);
            if (mode == para) return true;
            return false;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || parameter == null) return 1;
            bool mode = (bool)value;
            int para = System.Convert.ToInt16(parameter);
            if (mode == true) return para;
            return 1;
        }
    }
}
